package org.wenhuayuan.hilibrary.demo

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_log_demo.*
import org.wenhuayuan.hilibrary.R
import org.wenhuayuan.library.log.*

class HiLogDemoActivity : AppCompatActivity() {
    var viewPrinter: HiViewPrinter? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_log_demo)
        viewPrinter = HiViewPrinter(this)
        initView()
    }

    private fun initView() {
        HiLogManager.getInstance().addPrinter(viewPrinter)
        viewPrinter?.let {
            it.viewProvider.showFloatingView()
        }
        bt_log_demo_aty.setOnClickListener {
            HiLog.log(object: HiLogConfig(){
                override fun includeThread(): Boolean {
                    return true
                }

                override fun stackTraceDepth(): Int {
                    return 0
                }
            }, HiLogType.E, "=====测试====", "65535")
            HiLog.e("------ 日志 编码 成功 ------")
        }
    }
    private fun startIntent(cls: Class<AppCompatActivity>) {
        val intent = Intent(this, null)
        startActivity(intent)
    }
}
